/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package View;

import java.util.List;
import javax.swing.JOptionPane;
import model.dao.DaoBase;
import model.dao.DisciplinaJpaController;
import model.pojo.Disciplina;
import model.pojo.Professor;

/**
 *
 * @author leonidia
 */
public class OpcoesProfessor extends javax.swing.JFrame {

    private DaoBase daoBase;
    Professor professor;
    /**
     * Creates new form OpcoesProfessor
     */
    public OpcoesProfessor(DaoBase daoBase,Professor professor) {
        initComponents();
        this.professor = professor;
        this.daoBase = daoBase;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenu1 = new javax.swing.JMenu();
        buttonGroup1 = new javax.swing.ButtonGroup();
        CadastrarAtividade = new javax.swing.JRadioButton();
        ListarAtividade = new javax.swing.JRadioButton();
        CadastrarNota = new javax.swing.JRadioButton();
        ListarNota = new javax.swing.JRadioButton();
        CadastrarFaltas = new javax.swing.JRadioButton();
        ConsultarNTurmas = new javax.swing.JRadioButton();
        ConsultarnDisciplinas = new javax.swing.JRadioButton();
        ConsultarTurmas = new javax.swing.JRadioButton();
        ConsultarAluno = new javax.swing.JRadioButton();
        Voltar = new javax.swing.JButton();

        jMenu1.setText("jMenu1");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        buttonGroup1.add(CadastrarAtividade);
        CadastrarAtividade.setText("Cadastrar Atividade");
        CadastrarAtividade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CadastrarAtividadeActionPerformed(evt);
            }
        });

        buttonGroup1.add(ListarAtividade);
        ListarAtividade.setText("Listar Atividade");
        ListarAtividade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ListarAtividadeActionPerformed(evt);
            }
        });

        buttonGroup1.add(CadastrarNota);
        CadastrarNota.setText("Cadastrar Notas");
        CadastrarNota.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CadastrarNotaActionPerformed(evt);
            }
        });

        buttonGroup1.add(ListarNota);
        ListarNota.setText("Listar Notas");
        ListarNota.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ListarNotaActionPerformed(evt);
            }
        });

        buttonGroup1.add(CadastrarFaltas);
        CadastrarFaltas.setText("Cadastrar Faltas");
        CadastrarFaltas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CadastrarFaltasActionPerformed(evt);
            }
        });

        buttonGroup1.add(ConsultarNTurmas);
        ConsultarNTurmas.setText("Consultar o numero de turmas ja oferecidas (historicamente) para uma determinada disciplina");
        ConsultarNTurmas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultarNTurmasActionPerformed(evt);
            }
        });

        buttonGroup1.add(ConsultarnDisciplinas);
        ConsultarnDisciplinas.setText("Consultar o numero de disciplinas ja lecionadas");
        ConsultarnDisciplinas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultarnDisciplinasActionPerformed(evt);
            }
        });

        buttonGroup1.add(ConsultarTurmas);
        ConsultarTurmas.setText("Consultar turmas (informando disciplina, ano e periodo). Para listar as notas e faltas dos alunos");
        ConsultarTurmas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultarTurmasActionPerformed(evt);
            }
        });

        buttonGroup1.add(ConsultarAluno);
        ConsultarAluno.setText("Consultar a situacão de um aluno em uma disciplina - exibir nota, faltas e se ele foi aprovado ou reprovado");
        ConsultarAluno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultarAlunoActionPerformed(evt);
            }
        });

        Voltar.setText("Voltar ao menu inicial");
        Voltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                VoltarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(CadastrarAtividade)
                            .addComponent(ListarAtividade)
                            .addComponent(CadastrarNota)
                            .addComponent(ListarNota)
                            .addComponent(CadastrarFaltas)
                            .addComponent(ConsultarNTurmas)
                            .addComponent(ConsultarnDisciplinas)
                            .addComponent(ConsultarTurmas)
                            .addComponent(ConsultarAluno)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(194, 194, 194)
                        .addComponent(Voltar)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(CadastrarAtividade)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ListarAtividade)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CadastrarNota)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ListarNota)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(CadastrarFaltas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ConsultarNTurmas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ConsultarnDisciplinas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ConsultarTurmas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ConsultarAluno)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Voltar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void VoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VoltarActionPerformed
        // TODO add your handling code here:
        dispose();
        OpcaoInicial opcaoInicial = new OpcaoInicial();
        opcaoInicial.run();
    }//GEN-LAST:event_VoltarActionPerformed

    private void CadastrarAtividadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CadastrarAtividadeActionPerformed
        // TODO add your handling code here:
        CadastrarAtividade cadastrarAtividade = new CadastrarAtividade(daoBase,professor);
        cadastrarAtividade.run();
    }//GEN-LAST:event_CadastrarAtividadeActionPerformed

    private void CadastrarNotaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CadastrarNotaActionPerformed
        // TODO add your handling code here:
        CadastrarNotas cadastrarNotas = new CadastrarNotas(daoBase,professor);
        cadastrarNotas.run();
    }//GEN-LAST:event_CadastrarNotaActionPerformed

    private void CadastrarFaltasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CadastrarFaltasActionPerformed
        // TODO add your handling code here:
        CadastrarFaltas cadastrarFaltas = new CadastrarFaltas(daoBase);
        cadastrarFaltas.run();
    }//GEN-LAST:event_CadastrarFaltasActionPerformed

    private void ConsultarnDisciplinasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultarnDisciplinasActionPerformed
        // TODO add your handling code here:
        JOptionPane.showMessageDialog(this, professor.getTurma().size()+1, "Numero de turmas ja lecionadas", WIDTH);
    }//GEN-LAST:event_ConsultarnDisciplinasActionPerformed

    private void ConsultarTurmasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultarTurmasActionPerformed
        ConsultaTurmasAluno consultaTurmasAluno = new ConsultaTurmasAluno(daoBase);
        consultaTurmasAluno.run();
    }//GEN-LAST:event_ConsultarTurmasActionPerformed

    private void ConsultarNTurmasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultarNTurmasActionPerformed
        String nome;
        nome = JOptionPane.showInputDialog("Digite o nome da disciplina");
        DisciplinaJpaController disciplinaJpaController = new DisciplinaJpaController(null, daoBase.returnFactory());
        Integer numero =  disciplinaJpaController.procuraDisciplina(nome, daoBase, professor);//recebe numero de turmas determinada disciplina se repete no cadastro de turmas" 
        JOptionPane.showMessageDialog(this, numero, "Numero de turmas ja lecionadas", WIDTH);
    }//GEN-LAST:event_ConsultarNTurmasActionPerformed

    private void ConsultarAlunoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultarAlunoActionPerformed
        ConsultaSituacaoAluno consultaSituacaoAluno = new ConsultaSituacaoAluno(daoBase);
        consultaSituacaoAluno.run();
    }//GEN-LAST:event_ConsultarAlunoActionPerformed

    private void ListarAtividadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ListarAtividadeActionPerformed
        // TODO add your handling code here:
        ListarAtividade listarAtividade = new ListarAtividade(daoBase);
        listarAtividade.run();
    }//GEN-LAST:event_ListarAtividadeActionPerformed

    private void ListarNotaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ListarNotaActionPerformed
        // TODO add your handling code here:
        ListarNota listarNota = new ListarNota(daoBase);
        listarNota.run();
    }//GEN-LAST:event_ListarNotaActionPerformed

    /**
     * @param args the command line arguments
     */
    public void run() {
        setVisible(true);
    }

    public void stop() {
        setVisible(false);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton CadastrarAtividade;
    private javax.swing.JRadioButton CadastrarFaltas;
    private javax.swing.JRadioButton CadastrarNota;
    private javax.swing.JRadioButton ConsultarAluno;
    private javax.swing.JRadioButton ConsultarNTurmas;
    private javax.swing.JRadioButton ConsultarTurmas;
    private javax.swing.JRadioButton ConsultarnDisciplinas;
    private javax.swing.JRadioButton ListarAtividade;
    private javax.swing.JRadioButton ListarNota;
    private javax.swing.JButton Voltar;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JMenu jMenu1;
    // End of variables declaration//GEN-END:variables
}
